<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">

		</div>

		<div id="app2">
			初始的字符串：{{message}}
			<br />
			被反转的字符串：{{ reversedMessage }}
		</div>

		<div id="app3">
			test的值：{{test}}
		</div>

		<script type="text/javascript">
			var app = new Vue({
				el: "#app",
				data: {
					a: 1
				},
				created: function() {
					// this指向的是app实例
					console.log('a的值是:' + this.a)
				}
			});

			var app2 = new Vue({
				el: "#app2",
				data: {
					message: 'hello VUE!'
				},
				computed: {
					reversedMessage: function() {
						return this.message.split('').reverse().join('')
					}
				}
			});

			var data = {
				test: 1
			}
			var app3 = new Vue({
				el: "#app3",
				data: data
			});
			app3.$watch('test',function(newVal,oldVal){
				console.log("新值：" + newVal,"旧值：" + oldVal)
			})
			app3.$data.test = "2"
		</script>
	</body>
</html>
